package cool.zhoujie.address.adapter;

import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import androidx.databinding.BindingAdapter;
import cool.zhoujie.address.R;

public class BindingAdapters {

    @BindingAdapter("android:loadImage")
    public static void loadImage(ImageView imageView, Boolean isDefault) {
        Log.d("TAG", "loadImage: ");
        if (isDefault) {
            imageView.setImageDrawable(imageView.getResources().getDrawable(R.drawable.ic_selected));
        } else {
            imageView.setImageDrawable(imageView.getResources().getDrawable(R.drawable.ic_unselected));
        }
    }

    @BindingAdapter("isGone")
    public static void isGone(View view,Boolean isDefault) {
        if (isDefault) {
            view.setVisibility(View.VISIBLE);
        } else {
            view.setVisibility(View.GONE);
        }
    }

}
